import Vue from 'vue'

let vue = new Vue()

export function submit(query) {
  return vue.$fly.request({
    url: `/order/submit`,
    method: 'POST',
    data: query
  })
}

export function cancel(orderId) {
  return vue.$fly.request({
    url: `/order/cancel`,
    method: 'POST',
    params: {
      orderId
    }
  })
}

export function statusChange(orderId, status) {
  return vue.$fly.request({
    url: `/order/status-change`,
    method: 'POST',
    params: {
      orderId,
      status
    }
  })
}

export function detail(orderId) {
  return vue.$fly.request({
    url: `/order/detail`,
    method: 'GET',
    params: {
      orderId,
    }
  })
}

export function list(current, size, params) {
  return vue.$fly.request({
    url: `/order/list`,
    method: 'GET',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export function merchantOrderList(current, size, params) {
  return vue.$fly.request({
    url: `/order/merchant-order-list`,
    method: 'GET',
    params: {
      ...params,
      current,
      size,
    }
  })
}
